import { createRouter, createWebHistory } from 'vue-router'
import Dashboard from '../views/Dashboard.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/dashboard'
    },
    {
      path: '/dashboard',
      name: 'Dashboard',
      component: Dashboard
    },
    // 微应用路由 - 这些路由会被qiankun接管
    {
      path: '/master-data/:pathMatch(.*)*',
      name: 'MasterData',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/procurement/:pathMatch(.*)*',
      name: 'Procurement',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/operation/:pathMatch(.*)*',
      name: 'Operation',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/fresh/:pathMatch(.*)*',
      name: 'Fresh',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/warehouse/:pathMatch(.*)*',
      name: 'Warehouse',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/franchise/:pathMatch(.*)*',
      name: 'Franchise',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/wholesale/:pathMatch(.*)*',
      name: 'Wholesale',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/member/:pathMatch(.*)*',
      name: 'Member',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/finance/:pathMatch(.*)*',
      name: 'Finance',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/analytics/:pathMatch(.*)*',
      name: 'Analytics',
      component: () => import('../views/MicroApp.vue')
    },
    {
      path: '/system/:pathMatch(.*)*',
      name: 'System',
      component: () => import('../views/MicroApp.vue')
    }
  ]
})

export default router